package myJs.tool

import japgolly.scalajs.react.Callback

import scala.scalajs.js

/**
 * Created by yz on 13/12/2021
 */
object Pojo {

  case class FilterContentData(fieldName: String, label: String, values: List[String] = List[String]())

  trait SearchKind

  object TextSearch extends SearchKind

  object DateSearch extends SearchKind

  object NumericSearch extends SearchKind

  object DoubleSearch extends SearchKind

  object CheckboxSearch extends SearchKind

  object OnlySort extends SearchKind

  trait SearchData

  case class TextSearchData(searchType: String, text: String) extends SearchData

  case class DateSearchData(startDate: String, endDate: String) extends SearchData

  case class NumericSearchData(min: String, max: String, kind: String) extends SearchData

  case class CheckboxSearchData(values: List[String]) extends SearchData

  case object OnlySortData extends SearchData

  case class SortData(field: String, order: String, kind: String)

  case class ExportData(
    text: String,
    href: js.UndefOr[String] = js.undefined,
    onClick: js.UndefOr[(List[ujson.Obj], List[String]) => Callback] = js.undefined,
    disabled: Boolean = false
  )

}
